TCA Reducer の xctemplate

以下のファイルを ~/Library/Developer/Xcode/Templates/File Templates/Source/TCA Reducer.xctemplate/ に作る。

___FILEBASENAME___.swift の中身

//___FILEHEADER___

import ComposableArchitecture

@Reducer
public struct ___FILEBASENAME___ {
    public struct State: Equatable {
    }

    public enum Action: Equatable {
    }

    public var body: some ReducerOf<Self> {
        Reduce<State, Action> { state, action in
            return .none
        }
    }

    public init() {}
}

TemplateInfo.plist の中身

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>SupportsSwiftPackage</key>
    <true/>
    <key>Kind</key>
    <string>Xcode.IDEFoundation.TextSubstitutionFileTemplateKind</string>
    <key>Description</key>
    <string>An empty Swift file for Reducer of TCA.</string>
    <key>Summary</key>
    <string>TCA Reducer Swift file.</string>
    <key>SortOrder</key>
    <string>1</string>
    <key>Image</key>
    <dict>
        <key>FileTypeIcon</key>
        <string>swift</string>
    </dict>
    <key>AllowedTypes</key>
    <array>
        <string>public.swift-source</string>
    </array>
    <key>Platforms</key>
    <array />
    <key>DefaultCompletionName</key>
    <string>File</string>
    <key>MainTemplateFile</key>
    <string>___FILEBASENAME___.swift</string>
    <key>Options</key>
    <array>
        <dict>
            <key>Identifier</key>
            <string>productName</string>
            <key>Required</key>
            <true/>
            <key>Name</key>
            <string>Name:</string>
            <key>Description</key>
            <string>The name of the file to create</string>
            <key>Type</key>
            <string>text</string>
            <key>NotPersisted</key>
            <true/>
        </dict>
    </array>
</dict>
</plist>

swift-composable-architecture Xcode